/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.core.ui.properties.advanced;

import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.PropertyDescriptor;
import org.eclipse.uml2.uml.Element;

/**
 * Use to create a cell with specific dialogbox.
 * 
 * @author PT202707
 */
public class ChoosePropertyDescriptor extends PropertyDescriptor{
	
	/**
	 * 
	 */
	protected Class dialog;
	
	/**
	 * 
	 */
	protected Element element;
	
	/**
	 * 
	 * 
	 * @param element 
	 * @param dialog 
	 * @param id 
	 * @param displayName 
	 */
	public ChoosePropertyDescriptor(Object id,String displayName,Class dialog, Element element){
		super(id, displayName);
		this.dialog=dialog;
		this.element=element;

	}
	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.views.properties.PropertyDescriptor#createPropertyEditor(org.eclipse.swt.widgets.Composite)
	 */
	/**
	 * 
	 * 
	 * @param parent 
	 * 
	 * @return 
	 */
	@Override
	public CellEditor createPropertyEditor(Composite parent){

		CellEditor editor = new ChooseCellEditor(parent, dialog, element);
		if (getValidator() != null) {
			editor.setValidator(getValidator());
		}
		return editor;
	}

}
